|
|
|
|
|
|
|
Lets now build a class module that makes using the API calls easier. As you saw in the previous examples, when youre storing or retrieving data from the same section, you have to repeat the INI filename and section name as well as reallocate the buffer space every time. This can be quite a bit of work. Instead, lets wrap up this functionality in a class. |
|
|
|
|
|
|
|
|
Examples Filename: INI.cls |
|
|
|
|
|
|
|
|
Properties of the INI Class |
|
|
|
|
|
|
|
|
Table 29.1 shows you the public properties of this INI class as well as the private variable each property relates to inside of the class. |
|
|
|
|
| Table 29.1 Properties of the INI Class. | | Public Property | Private Variable | Description | | ConfigName | mstrConfigName | The name of the INI file | | SectionName | mstrSection | The name of the section to retrieve data from or set data to | | KeyName | mstrKeyName | The name of the key to read from or write to | | KeyValue | mstrKeyValue | The value to write to the INI file |
|
|
|
|
|
|
Public Methods of the INI Class |
|
|
|
|
|
|
|
|
Besides the properties of the INI class, you have methods that allow you to read and write to the INI file. Table 29.2 lists each of the method names and provides a description of each. |
|
|
|
|
| Table 29.2 Methods of the INI Class. | | Method Name | Description | | KeyGet | Retrieves information from the INI file and returns it as a string value | | KeySave | Saves information back to the INI file |
|
|
|
|
|
|
(table continued on next page) |
|
|
|
|
|